#ifndef YOOHOO_XMPPCORE_ERRORPARSERFACTORY_H
#define YOOHOO_XMPPCORE_ERRORPARSERFACTORY_H

#include "xmppcore/xmppparserfactory.h"
#include "xmppcore/error.h"
#include "xmppcore/stanza.h"

namespace yoohoo_xmppcore {

class ErrorParser : public XmppParser {
public:
	ErrorParser(Error::ErrorType errorType);
	XmppObject* obj();
	bool processAttributes(QString path, QList<ParsingAttribute> attributes);
	bool processEmbeddedObject(ProtocolKey protocolKey, XmppObject* obj);
	bool processText(QString path, QString text);
	Stanza::StanzaKind stanzaKind() const;

protected:
	bool processErrorText(XmppObject* obj);
	bool processDefinedCondition(XmppObject* obj);
	bool processApplicationSpecificCondition(XmppObject* obj);

protected:
	Error* _error;
	Error::ErrorType _errorType;
};

class ErrorParserFactory : public XmppParserFactory {
public:
	ErrorParserFactory(Error::ErrorType errorType);
	ProtocolKey protocolKey();
	XmppParser* createParser();

protected:
	Error::ErrorType _errorType;
};

}

#endif
